//
//  AuctionPubNotisTableViewCell.m
//  MyNewProject
//
//  Created by 王春辉 on 2020/1/5.
//  Copyright © 2020年 sun. All rights reserved.
//

#import "AuctionPubNotisTableViewCell.h"

@interface AuctionPubNotisTableViewCell()

@property (nonatomic, strong) UILabel *titleLabel;
@end

@implementation AuctionPubNotisTableViewCell
@synthesize imageView = _imageView;
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.layer.masksToBounds = true;
        self.layer.cornerRadius = 4.0;
        [self initContentViews];
    }
    return self;
}

- (void)initContentViews {
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(12);
        make.right.mas_lessThanOrEqualTo(-12);
        make.top.mas_offset(12);
        make.bottom.mas_equalTo(self.imageView.mas_top).mas_offset(-12);
    }];
    
    [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.titleLabel);
        make.right.mas_offset(-12);
        make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_equalTo(12);
        make.bottom.mas_offset(-12);
        make.height.mas_equalTo(self.imageView.mas_width).multipliedBy(240.0/476);
    }];
}

#pragma mark -- mark 懒加载
- (UIImageView *)imageView {
    if (!_imageView) {
        _imageView = [[UIImageView alloc] init];
        _imageView.layer.masksToBounds = true;
        _imageView.layer.cornerRadius = 4.0;
        [self.contentView addSubview:_imageView];
    }
    return _imageView;
}
- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.text = @" ";
        _titleLabel.font = SKFONT_Medium(15);
        _titleLabel.textColor = SKColorWithHex(0x333333);
        [self.contentView addSubview:_titleLabel];
    }
    return _titleLabel;
}

#pragma mark -- mark 业务逻辑
- (void)setTitle:(NSString *)title {
    _title = title;
    self.titleLabel.text = title;
}
@end
